package com.huayi.server.Controller.app;

import com.huayi.server.Entity.CameraEntity;
import com.huayi.server.Repository.CameraRepostiory;
import com.huayi.server.Utils.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/camera")
public class CameraController {

    @Autowired
    CameraRepostiory repostiory;

    @Autowired
    Resp resp;

    @RequestMapping("/all")
    @ResponseBody
    public Resp list(){
        List<CameraEntity> list = (List<CameraEntity>) repostiory.findAll();
        resp.setCode(200);
        resp.setData(list);
        return resp;
    }
}
